﻿
using System;
using System.Windows;
using log4net;
using WPFEdit.Framework;

namespace SampleApp
{
	class ErrorHandler : IErrorHandler
	{
		public void HandlerError(string message, Exception ex, ILog logger)
		{
			if (ex != null && ex.GetType() == typeof(TaskException)) ex = ((TaskException)ex).StepException;
			if (ex != null)
			{
				logger.Error(message, ex);
				MessageBox.Show(message + " " + ex);
			}
			else
			{
				logger.Error(message);
				MessageBox.Show(String.Format("{0}", message));
			}
		}
	}
}
